<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title>test</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../../../static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../../../static/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="../../../static/ajax/libs/bootstrap-table/bootstrap-table.min.css?v=20200727" rel="stylesheet"/>
    <link href="../../../static/css/animate.css" rel="stylesheet"/>
    <link href="../../../static/css/style.css?v=20200727" rel="stylesheet"/>
    <link href="../../../static/udi/css/jt-ui.css\?v=4.4.0" rel="stylesheet"/>
    <th:block th:include="include :: header('boostrap表格测试页面')" />
</head>
<body>
<div class="container-fluid">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="post-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                岗位编码：<input type="text" name="postCode"/>
                            </li>
                            <li>
                                岗位名称：<input type="text" name="postName"/>
                            </li>
                            <li>
                                岗位状态：<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()">
                    <i class="fa fa-plus"></i> 新增
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table">
                    <tr>
                        <th>12</th>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</div>
<script src="../../../static/js/jquery.min.js"></script>
<script src="../../../static/js/bootstrap.min.js"></script>
<script src="../../../static/ajax/libs/bootstrap-table/bootstrap-table.min.js"></script>
<script src="../../../static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="../../../static/udi/js/jt-ui.js"></script>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    /*var editFlag = [[${@permission.hasPermi('system:post:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:post:remove')}]];
    var datas = [[${@dict.getType('sys_normal_disable')}]];*/

    $("#btn_query").on('click',function () {
        var obj = {};

        for (var i in obj) {
            console.log(obj.hasOwnProperty(i));
        }
    })
    $(function() {
        var options = {
            url: "/test2",
            sortName: "id",
            modalName: "岗位",
            pageSize: 5,
            pageList: [5,6,9,10],
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '岗位编号',
                    sortable: true
                },
                {
                    field: 'name',
                    title: '岗位编码',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.postId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.postId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    /*$(function () {
        //1.初始化Table
        var oTable = new TableInit();
        oTable.Init();
        //2.初始化Button的点击事件
        var oButtonInit = new ButtonInit();
        oButtonInit.Init();
    });

    var TableInit = function () {
        var oTableInit = new Object();
        //初始化Table
        oTableInit.Init = function () {
            $('#tb_departments').bootstrapTable({
                url: '/test1',         //请求后台的URL（*）
                method: 'get',                      //请求方式（*）
                toolbar: '#toolbar',                //工具按钮用哪个容器
                striped: false,                      //是否显示行间隔色
                cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                pagination: true,                   //是否显示分页（*）
                sortable: true,                     //是否启用排序
                sortOrder: "asc",                   //排序方式
                queryParams: oTableInit.queryParams,//传递参数（*）
                sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                pageNumber:1,                       //初始化加载第一页，默认第一页
                pageSize: 5,                       //每页的记录行数（*）
                pageList: [5, 10, 50, 100],        //可供选择的每页的行数（*）
                search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                strictSearch: true,
                showColumns: true,                  //是否显示所有的列
                showRefresh: true,                  //是否显示刷新按钮
                minimumCountColumns: 2,             //最少允许的列数
                clickToSelect: true,                //是否启用点击选中行
                height: 500,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
                uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
                showToggle:true,                    //是否显示详细视图和列表视图的切换按钮
                cardView: false,                    //是否显示详细视图
                detailView: false,                   //是否显示父子表
                columns: [{
                    checkbox: true
                }, {
                    field: 'Name',
                    title: '部门名称',
                    sortable:true
                }, {
                    field: 'ParentName',
                    title: '上级部门',
                    sortable:true
                }, {
                    field: 'Level',
                    title: '部门级别',
                    sortable:true
                }, {
                    field: 'Desc',
                    title: '描述'
                }, ]
            });
        };

        //得到查询的参数
        oTableInit.queryParams = function (params) {
            var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                pageSize: params.limit,   //页面大小
                pageNum: params.offset/params.limit+1,  //页码
                orderByColumn: params.sort,
                departmentname: $("#txt_search_departmentname").val(),
                statu: $("#txt_search_statu").val(),
                searchValue:    params.search,
                isAsc:          params.order
            };
            return temp;
        };
        return oTableInit;
    };

    var ButtonInit = function () {
        var oInit = new Object();
        var postdata = {};

        oInit.Init = function () {
            //初始化页面上面的按钮事件
        };

        return oInit;
    };*/

</script>
</body>
</html>